<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<link rel="stylesheet"
	href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
<link type="text/css" rel="stylesheet"
	href="resources/css/office/jindanjupsoo.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.0/jquery-ui.js"></script>

<script type="text/javascript">
	function select(opt) {
		var patient_name = $("input[name='patient_name']").val();
		if (opt == 'Y') {
			$("#TARGET").val(patient_name);
		} else {
			$("#TARGET").val("");
		}
	}
	$(document).ready(function(){	
		$("#jup_ok").click(function(){			
 			var jupsoo_id = $("input[name='jupsoo_id']").val();
			var patient_name = $("input[name='patient_name']").val();		
			var is_personally = $("select[name='IS_PERSONALLY']").val();		
			var is_document = $("select[name='IS_DOCUMENT']").val();		
			var target = $("input[name='TARGET']").val();		
			var jumin1 = $("input[name='JUMIN1']").val();		
			var jumin2 = $("input[name='JUMIN2']").val();jindantype
			var jindantype = $("select[name='jindantype']").val();
			
			$.ajax({
				url : "jindanjupsooInsert.do",
				data : "jupsoo_id="+jupsoo_id+"&is_personally="+is_personally+
					   "&is_document="+is_document+"&target="+target+"&jumin1="+jumin1+
					   "&jumin2="+jumin2+"&jindantype="+jindantype,
				success:function(data){
					alert("진단서를 접수 했습니다.");			
					$(".div_text").children().val("");
					$(".jumin").val("");
					window.location.href='patientinfo.do';
				}			
			});		
		});
	});

	
</script>
<script>
	$(function() {
		$("#IS_PERSONALLY").selectmenu();
		$("#IS_DOCUMENT").selectmenu();
		$("#jindantype").selectmenu();
	});	
</script>

<div class="jindanjupsoo_frame">
	<div class="jindanjupsoo_table_caption"style="">
		진단서 접수
	</div>
	<div>
		<table class="jindanjupsoo_table">
			<tr>
				<td>접수 번호</td>
				<td><input type="hidden" name="patient_id"
					value="${patient_id }"><input type="text" class="text"
					name="jupsoo_id" value="${jupsoo_id }" readonly></td>
			</tr>
			<tr>
				<td>접수자 이름</td>
				<td><input type="text" class="text" name="patient_name"
					value="${name}" readonly></td>
			</tr>
			<tr>
				<td>본인 여부</td>
				<td><select name="IS_PERSONALLY" id="IS_PERSONALLY"
					class="IS_PERSONALLY" onchange="select(this.value);">
						<option selected="selected">선택</option>
						<option value="Y">본인</option>
						<option value="N">타인</option>
				</select></td>
			</tr>
			<tr>
				<td>서류제출 여부</td>
				<td><select name="IS_DOCUMENT" id="IS_DOCUMENT">
						<option value="Y">서류 제출</option>
						<option value="N">서류 없음</option>
				</select></td>
			</tr>
			<tr>
				<td>대상자 이름</td>
				<td><input type="text" class="text" name="TARGET" id="TARGET"
					placeholder="대상자명 입력"></td>
			</tr>
			<tr>
				<td>대상자 주민번호</td>
				<td><input type="text" name="JUMIN1" maxlength="6"
					class="jumin" placeholder="주민번호 앞 6자리"> - <input
					type="password" name="JUMIN2" maxlength="7" class="jumin"
					placeholder="주민번호 뒤 7자리"></td>
			</tr>
			<tr>
				<td>진단서 종류</td>
				<td><select name="jindantype" id="jindantype">
						<option selected>진단서 종류</option>
						<option value="CTF01">상해진단서</option>
						<option value="CTF02">사망진단서</option>
				</select></td>
			</tr>
		</table>
	</div>
	<div class="btn" style="text-align: center;">
		<button id="jup_ok" class="normalBtn" name="jup_ok">접수</button>
		<button type="button" class="normalBtn" id="jup_cancel">취소</button>
	</div>
</div>


